package com.transaction.simulate.mapper;

import com.transaction.common.base.PageInfo;
import com.transaction.simulate.model.dto.Dict;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Title:
 * @Package
 * @Auther: Administrator
 * @Date: 2022/3/8 16:15
 * @Description:
 */
public interface DictMapper {

    @Select("SELECT dictKey FROM t_dict WHERE isUsed = 1 AND parentId = ( SELECT t.id FROM t_dict t WHERE t.dictKey = #{parentKey} AND t.isUsed = 1 ) ORDER BY id")
    List<String> selectKeysByParentKey(String parentKey);

    @Select("SELECT * FROM t_dict t WHERE t.parentId = 0 ")
    List<Dict> getRootDictInfo(PageInfo pageInfo, Dict dict);

    @Select("SELECT * FROM t_dict t WHERE t.parentId = #{parentId}")
    List<Dict> getDictInfoByParentId(Integer parentId);
}
